package com.tool;

import com.google.common.collect.Lists;
import org.apache.commons.lang.math.RandomUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: tzj
 * @create: 2022-10-11
 * 集合分批测试
 **/
public class BatchProcessingTest {

    public static void main(String[] args) {
        List<Integer> ids = new ArrayList<>();
        for (int i = 0; i < 500; i++) {
            int random = RandomUtils.nextInt(100);
            ids.add(random);
        }

        List<List<Integer>> partition = Lists.partition(ids, 100);
        partition.forEach(batchIds -> System.out.println(batchIds));
    }
}
